<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let obj = {};
        
        // handler为空对象
        // let proxy = new Proxy(obj, {});
        // // proxy代理需要直接操作proxy对象
        // proxy.a = 1;
        // proxy.b = 2;

        // console.log('obj:', obj);

        let proxy = new Proxy(obj, {
            // get拦截
            get(target, key, receiver){
                return target.a + 1;
            }
        });

        proxy.a = 1;
        console.log('proxy:',proxy.a);//35
    </script>
</body>
</html>